home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / osi / isode / vmsisode / vmsisode80_tar.Z / vmsisode80_tar / sockit / gccinclude / x11 / xmd.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-04-24  |  6.2 KB  |  166 lines

  1. /*
  2. *****************************************************************************
  3. **                                                                          *
  4. **                         COPYRIGHT (c) 1988 BY                            *
  5. **             DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.                *
  6. **               ALL RIGHTS RESERVED                              *
  7. **                                                                          *
  8. **  THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND  COPIED  *
  9. **  ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH  LICENSE AND WITH THE  *
  10. **  INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR  ANY  OTHER  *
  11. **  COPIES  THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY  *
  12. **  OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF  THE  SOFTWARE  IS  HEREBY  *
  13. **  TRANSFERRED.                                                            *
  14. **                                                                          *
  15. **  THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE  WITHOUT  NOTICE  *
  16. **  AND  SHOULD  NOT  BE  CONSTRUED  AS  A COMMITMENT BY DIGITAL EQUIPMENT  *
  17. **  CORPORATION.                                                            *
  18. **                                                                          *
  19. **  DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR  RELIABILITY  OF  ITS  *
  20. **  SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.                 *
  21. **                                                                          *
  22. *****************************************************************************
  23. **++
  24. **  FACILITY:
  25. **
  26. **    < to be supplied >
  27. **
  28. **  ABSTRACT:
  29. **
  30. **    < to be supplied >
  31. **
  32. **  ENVIRONMENT:
  33. **
  34. **    < to be supplied >
  35. **
  36. **  MODIFICATION HISTORY:
  37. **
  38. **    < to be supplied >
  39. **
  40. **--
  41. **/
  42. #ifndef XMD_H
  43. #define XMD_H 1
  44. /* $Header: Xmd.h,v 1.16 87/07/05 17:12:43 susan Exp $ */
  45. /*
  46.  *  MACHINE DEPENDENT DECLARATIONS.
  47.  *
  48.  *  These are for the VAX
  49.  *
  50.  */
  51.  
  52. #define B16
  53. #define B32
  54.  
  55. typedef long           INT32;
  56. typedef short          INT16;
  57. typedef char           INT8;
  58.  
  59. typedef unsigned long CARD32;
  60. typedef unsigned short CARD16;
  61. typedef unsigned char  CARD8;
  62.  
  63. typedef unsigned long        BITS32;
  64. typedef unsigned short        BITS16;
  65. typedef unsigned char        BYTE;
  66.  
  67. typedef unsigned char            BOOL;
  68.  
  69. /*
  70.  * Machine dependent values:
  71.  * GLYPHPADBYTES should be chosen with consideration for the space-time
  72.  * trade-off.  Padding to 0 bytes means that there is no wasted space
  73.  * in the font bitmaps (both on disk and in memory), but that access of
  74.  * the bitmaps will cause odd-address memory references.  Padding to
  75.  * 2 bytes would ensure even address memory references and would
  76.  * be suitable for a 68010-class machine, but at the expense of wasted
  77.  * space in the font bitmaps.  Padding to 4 bytes would be good
  78.  * for real 32 bit machines, etc.  Be sure that you tell the font
  79.  * compiler what kind of padding you want because its defines are
  80.  * kept separate from this.  See server/include/fonts.h for how
  81.  * GLYPHPADBYTES is used.
  82.  *
  83.  * Along with this, you should choose an appropriate value for
  84.  * GETLEFTBITS_ALIGNMENT, which is used in ddx/mfb/maskbits.h.  This
  85.  * constant choses what kind of memory references are guarenteed during
  86.  * font access; either 1, 2 or 4, for byte, word or longword access,
  87.  * respectively.  For instance, if you have decided to to have
  88.  * GLYPHPADBYTES == 4, then it is pointless for you to have a
  89.  * GETLEFTBITS_ALIGNMENT > 1, because the padding of the fonts has already
  90.  * guarenteed you that your fonts are longword aligned.  On the other
  91.  * hand, even if you have chosen GLYPHPADBYTES == 1 to save space, you may
  92.  * also decide that the computing involved in aligning the pointer is more
  93.  * costly than an odd-address access; you choose GETLEFTBITS_ALIGNMENT == 1.
  94.  * 
  95.  * XXX: this code has changed since beta test and only GLYPHPADBYTES == 4
  96.  * has been tested, hence all machines have this same value.
  97.  *
  98.  */
  99.  
  100. /* size of buffer to use with GetImage, measured in bytes. There's obviously
  101.  * a trade-off between the amount of stack (or whatever ALLOCATE_LOCAL gives
  102.  * you) used and the number of times the ddx routine has to be called.
  103.  * 
  104.  * for a 1024 x 864 bit monochrome screen  with a 32 bit word we get 
  105.  * 8192/4 words per buffer 
  106.  * (1024/32) = 32 words per scanline
  107.  * 2048 words per buffer / 32 words per scanline = 64 scanlines per buffer
  108.  * 864 scanlines / 64 scanlines = 14 buffers to draw a full screen
  109.  */
  110.  
  111. #define IMAGE_BUFSIZE        8192
  112.  
  113. #define IMAGE_BYTE_ORDER    LSBFirst
  114. #define BITMAP_SCANLINE_UNIT    32
  115. #define BITMAP_SCANLINE_PAD    32 /* for a VAX, pad scanline to a longword */
  116. #define BITMAP_BIT_ORDER    LSBFirst
  117. #define    GLYPHPADBYTES        1
  118. #define    GETLEFTBITS_ALIGNMENT    4
  119.  
  120. #define LOG2_BITMAP_PAD        5
  121. #define LOG2_BYTES_PER_SCANLINE_PAD    2
  122.  
  123. /* 
  124.  *    this returns the number of padding units, for depth d and width w.
  125.  *    for bitmaps this can be calculated with the macros above.
  126.  *    other depths require either grovelling over the formats field of the
  127.  *    screenInfo or hardwired constants.
  128.  */
  129.  
  130. typedef struct _PaddingInfo {
  131.      int    scanlinePad;
  132.      int    bitmapPadLog2;
  133. } PaddingInfo;
  134.  
  135. extern PaddingInfo PixmapWidthPaddingInfo[];
  136.  
  137. #define PixmapWidthInPadUnits(w, d) \
  138.      (((w) + PixmapWidthPaddingInfo[d].scanlinePad) >> \
  139.      PixmapWidthPaddingInfo[d].bitmapPadLog2)
  140.   
  141. /*
  142.  *    Return the number of bytes to which a scanline of the given
  143.  *    depth and width will be padded.
  144.  */
  145. #define PixmapBytePad(w, d) \
  146.     (PixmapWidthInPadUnits(w, d) << LOG2_BYTES_PER_SCANLINE_PAD)
  147.  
  148. /* Get a bit from a pixel.  pixel is a pixel of the specified depth and we
  149.  * want the bit in position plane (where 0 is the least significant plane
  150.  * and depth -1 is the most significant.) 
  151.  * How you extract the bit depends on image-byte-order and depth.
  152.  * You can assume that pixel is big enough to  hold a pixel depth bits deep.
  153.  *
  154.  * The result is cast to be an unsigned char.  This seems like the least
  155.  * common denominator, no matter what depth you have, you're only getting a
  156.  * bit out.  
  157.  * 
  158.  * (Currently this is used only by miGetPlane.)
  159.  * The one bit case, shown below, is obvious.  The least significant bit
  160.  * is the one we want.  */
  161.  
  162. #define GetBitFromPixel(pixel, plane, depth) \
  163.     ((unsigned char) ((depth*0)+((pixel) & (1 << (plane)))))
  164.  
  165. #endif /* XMD_H */
  166.